﻿using Airborne.ScrumPoker.Module.Client.Controllers;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Unity;

namespace Airborne.ScrumPoker.Module.Client
{
    public class ClientModule : IModule
    {
         #region Constructor
        public ClientModule(IUnityContainer container)
        {
            Container = container;
        }
        #endregion

        #region Properties
        private IUnityContainer Container { get;  set; }

        #endregion

        #region IModule Members

        public void Initialize()
        {
            RegisterComponents();
            Container.Resolve<IClientController>().Run();
        }

        #endregion

        #region Methods
        private void RegisterComponents()
        {
            Container.RegisterType<IClientController, ClientController>(new ExternallyControlledLifetimeManager());
        }
        #endregion
    }
}
